/*启动服务*/
package main

import (
	"fmt"
	"forum/app/config"
	"forum/app/model"
	Redis "forum/app/redis"
	"forum/route"
	"net/http"
)

// Response 定义响应结构体
type Response struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func main() {
	//引入配置
	config.Setup()
	//注册路由
	route.InitAdmin()
	route.InitApi()
	//连接数据库
	model.InitDB()
	// 初始化 Redis 连接
	Redis.InitRedis()
	defer Redis.CloseRedis()
	//启动服务
	fmt.Println("Server starting on :12345")
	err := http.ListenAndServe(":12345", nil)
	if err != nil {
		fmt.Println("启动服务失败:", err)
	} else {
		fmt.Println("Server started successfully")
	}
}
